#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableMailConfigDao:DaoBase<TableMailConfig>
    {
        public override string GetFileName()
        {
            return "TableMailConfig.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableMailConfig>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableMailConfig model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.mailId)) UnityEngine.Debug.LogError("数据表id重复:TableMailConfig->id: " + model.mailId);
            #endif
            cachePrimaryInt[model.mailId] = model;
        }
        protected override TableMailConfig ParseRowData(string[] rowData)
        {
            TableMailConfig data = new TableMailConfig();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.mailId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.mailType = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.mailTitle = rowData[2];
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.mailIcon = string.Intern(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.mailContent = rowData[4];
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.isItemDelete = int.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.isTimeDelete = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.feedbackMessage = rowData[7];
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.mailTiming = int.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.mailSender = rowData[9];
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.mailAudio = rowData[10];
            }
            return data;
        }
    }
}
